package com.xindaoapp.happypet.utils;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;

public class AppVersionUtil {
	public static String  getVersion(Context context){
		PackageManager pg=context.getPackageManager();
		try {
			PackageInfo info=pg.getPackageInfo(context.getPackageName(), 0);
			String versionNow=info.versionName;
			return versionNow;
		} catch (NameNotFoundException e) {
			e.printStackTrace();
			//不可能发生的异常。
			return "";
		}
	}
}
